home *** CD-ROM | disk | FTP | other *** search
- Path: blue.cse.ogi.edu!leneis
- From: leneis@blue.cse.ogi.edu (Tony Leneis)
- Newsgroups: comp.sys.amiga.misc
- Subject: Re: AmigaOS 4.x features
- Date: 31 Mar 1996 05:56:11 GMT
- Organization: Oregon Graduate Institute (OGI), Portland, Oregon
- Message-ID: <4jl6pr$knv@reuter.cse.ogi.edu>
- References: <4j7ein$a6v@B1FF.mindspring.com> <4jfm8i$b5n@B1FF.mindspring.com> <4jgc6q$a61@reuter.cse.ogi.edu> <4jkg5j$dva@B1FF.mindspring.com>
- NNTP-Posting-Host: blue.cse.ogi.edu
-
- In article <4jkg5j$dva@B1FF.mindspring.com>,
- Charlie Moody <chmood@photobooks.atdc.gatech.edu> wrote:
- >On 29 Mar 1996 09:57:46 GMT, Tony Leneis wrote:
- >: I'll grant that * is easier than #?, but the Amiga pattern matching
- >: is more powerful than traditional UNIX globbing. As was pointed out earlier,
- >: you can always enable a UNIX-ish * by using a utility like wildstar.
- >
- >It may be *as* powerful, but not moreso (and what the heck is 'UNIX
- >globbing'?), and certainly not as well thought out. And that's the point
- >about enabling the '*': it's easy, and not nearly as useful as it would
- >be in context.
-
- First, globbing is filename wildcarding. Since some UNIX programs
- do regexp patterns and others do glob patterns, you need to make the
- distinction. Regexp pattern matching is much more powerful than globbing,
- but it's not as convenient to express. When I say that the Amiga pattern
- matching is more powerful than globbing, I mean there are patterns that
- Amiga pattern matching can express which globbing cannot. For example:
-
- test#a <- Matches 'test', 'testa', 'testaa', 'testaaa', etc.
- test#(ab)c <- Matches 'testc', 'testabc', 'testababc', 'testabababc', etc.
- ~(#?.info) <- Matches anything that doesn't end in '.info'
- * To be fair, a few UNIX shells provide this functionality
- exp(ab|cd).c <- Matches 'expab.c' and 'expcd.c'
- * Again, _some_ UNIX shells provide this functionality
-
- On the other hand, there are no UNIX globbing patterns which cannot be
- expressed as an Amiga pattern. Hence, Amiga patterns are more powerful.
-
- >Yes, I can get the same effect as in can under unix pattern-matching...all
- >I have to do is use a completely different, much more cumbersome, and much
- >less intuitive (read: badly designed) method.
-
- It's different, because it's essentially allowing you to do full regular
- expressions. Would you have preferred the standard UNIX regular expression
- syntax? Then you'd have to type '.*' instead of '#?', and you'd have to
- remember to escape the '.' whenever you didn't want it to act as the Amiga
- '?' metacharacter. (Kind of a bummer if you're looking for '#?.c', or should
- I say '.*\.c' as a UNIX regular expression.)
-
- Where UNIX has two different pattern-matching systems that you have to learn,
- the Amiga has one. Seems much simpler to me. (Never mind the fact that each
- UNIX shell and utility seems to have it's own special little modification to
- glob patterns and regexp patterns.)
-
- >That's not "more flexible"; it's not "more powerful"; and it sure as
- >h*ll ain't any easier. Isn't it basic common sense to avoid re-inventing
- >the wheel *whenever* possible?
-
- As mentioned above, it is more flexible and more powerful, because anything
- that can be expressed as a UNIX glob pattern can be expressed as an Amiga
- pattern, and then some. Just out of curiosity, whose wheel should they have
- used instead of inventing their own? As far as I know, there was no RFC or
- other standard for file wildcarding when AmigaDOS was developed. Which UNIX
- shell should they have followed? Or, should they have done it like VMS? MVS?
- MS-DOS? Each of these does pattern matching in different ways.
-
- >: For example, "dir sys:(a|b|c|e)#?".
- >
- >[additional references to documentation for more counter-intuitive,]
- >[anti-logical methods deleted]
- >
- > dir sys:[a-e]*
- >
- >Logical, simple, fast: elegant.
-
- Well, you can certainly do it with a current version of AmigaDOS.
- So, what's the problem? One minor nit - that should be 'dir sys:[a-ce]*'
- if you want it to be the same as the 1.3 AmigaDOS pattern matching example
- above. One thing I'd like to see added is the ability to compliment sets.
- i.e. [^abc] matches anything except 'a', 'b', or 'c'.
-
- >; The main problem,
- >: if you want to call it a problem, is that it's different. It also can be a
- >: little more awkward to use for certain patterns, but it always can get the
- >: job done.
- >
- >The fact that the kludge can be worked around does nothing to redeem the
- >kludge. It's still bad design with no significant benefit from making
- >the sacrifices, and it should be thrown overboard at the first opportunity.
-
- It's not a kludge, and there's nothing wrong with the design. It is much
- more useful than MS-DOS or UNIX globbing. If I wanted that, I'd just run
- Linux or CrossPC on my Amiga.
-
- Throwing the Amiga pattern matching overboard would not only reduce the power
- of AmigaDOS, it would also reduce the power of editors and other applicaitons
- and utilities that allow you to do pattern matching. I'd rather see Amiga
- pattern matching extended and perhaps made more efficient (efficient as in
- time it takes for the pattern-matching code to run.)
-
- >: I'd certainly take the functionality of the # operator any day
- >: over the UNIX * operator (provided I've got a match-any-character operator
- >: to go with it.)
- >
- >You'd gladly throw away the match-any-character option, provided you've
- >got a match-any-character option to replace it???
-
- No. The UNIX * operator is match-any-sequence-of-characters. The UNIX ? and
- the AmigaDOS ? operator is match-any-character. The AmigaDOS # operator is
- match-any-number-of. So, I'd prefer the ability to match any number of
- arbitrary patterns, provided I had a way to match any character, rather than
- only being able to match any sequence of characters.
-
- -Tony
- --
- =====///===Hi!==I'm=a=.signature=virus!==Copy=me=to=your=.signature!===///==
- __ /// leneis@cse.ogi.edu From the desk of: Hillary, __ ///
- \\\/// tony@plaza.ds.adp.com -->Tony Leneis<-- Gennifer, \\\///Only
- \XX/ aleneis@gauss.math.hmc.edu HMC '91 Go Stags! AND NOW US!\XX/Amiga
-